package cn.t.enums;

import cn.t.core.enums.Enumer;
import cn.t.core.enums.base.CommonEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author l
 */
@Enumer
@Getter
@AllArgsConstructor
public enum PickStatusEnum implements CommonEnum<Integer, String> {
    //缺货、领用已超额
    NO_STOCK(0,"缺货"),
    OVER_PICKUP(1,"领用已超额"),
    PICKUP_SUCCESS(2,"正常");
    @JsonValue
    @EnumValue
    private final Integer code;
    private final String name;
    public static PickStatusEnum getByCode(Integer code) {
        for (PickStatusEnum statusEnum : PickStatusEnum.values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}
